import bisect

n, m = map(int, input().split())
points = []
for _ in range(n):
    li, ri = map(int, input().split())
    points.append((li + ri) / 2)
points.sort()


def bisect_se(num):
    left = 0
    right = n - 1
    while left <= right:
        mid = (left + right) >> 1
        if points[mid] <= num:
            left = mid + 1
        else:
            right = mid - 1
    return left - 1


for _ in range(m):
    li, ri = map(int, input().split())
    # 查询大于等于左端点，小于等于右端点
    l = bisect.bisect_left(points, li)
    r = bisect_se(ri)
    print(r - l + 1)
